	/**
	 * Class org.redemptionhosts.model.Host
	 *
	 * Copyright 2011 Matthew J. Brinkman
	 *
	 * Licensed under the Apache License, Version 2.0 (the "License");
	 * you may not use this file except in compliance with the License.
	 * You may obtain a copy of the License at
	 *
	 *   http://www.apache.org/licenses/LICENSE-2.0
	 *
	 * Unless required by applicable law or agreed to in writing, software
	 * distributed under the License is distributed on an "AS IS" BASIS,
	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	 * See the License for the specific language governing permissions and
	 * limitations under the License.
	 */
package org.redemptionhost.model;

import java.io.Serializable;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.Query;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.users.User;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
@Query(name="allHosts",
       value="select from org.redemptionhost.model.Host order by lastName, firstName")
public class Host implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;

	@Persistent
	private User user;
		
	@Persistent
	private String firstName;
		
	@Persistent
	private String lastName;
	
	@Persistent
	private HostAge hostAge;
		
	@Persistent
	private String streetAddress;
		
	@Persistent
	private String city;
		
	@Persistent
	private String state;
		
	@Persistent
	private String zip;
		
	@Persistent
	private String phone;
		
	@Persistent
	private String email;
		
	@Persistent
	private Boolean isAdministrator;
		
	@Persistent
	private String redemptionCode;		//	Used to allow transfer of ownership.

	@Persistent
	private Boolean isActive;

	public Host(final String firstName,
			final String lastName,
			final HostAge hostAge,
			final String streetAddress,
			final String city,
			final String state,
			final String zip,
			final String phone,
			final String email) {
		super();
		this.firstName = firstName;
		this.lastName = lastName;
		this.hostAge = hostAge;
		this.streetAddress = streetAddress;
		this.city = city;
		this.state = state;
		this.zip = zip;
		this.phone = phone;
		this.email = email;
		this.isActive = true;
	}

	public Host(final String firstName,
			final String lastName,
			final HostAge hostAge,
			final String streetAddress,
			final String city,
			final String state,
			final String zip,
			final String phone,
			final String email,
			final String redemptionCode,
			final Boolean isAdministrator) {
		super();
		this.firstName = firstName;
		this.lastName = lastName;
		this.hostAge = hostAge;
		this.streetAddress = streetAddress;
		this.city = city;
		this.state = state;
		this.zip = zip;
		this.phone = phone;
		this.email = email;
		this.redemptionCode = redemptionCode;
		this.isAdministrator = isAdministrator;
		this.isActive = true;
	}
	
	public Host() {
	}

	public Key getKey() {
		return key;
	}
		
	public User getUser() {
		return this.getUser();
	}
		
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
		
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
		
	public HostAge getHostAge() {
		return hostAge;
	}
	public void setHostAge(HostAge hostAge) {
		this.hostAge = hostAge;
	}
		
	public void setStreetAddress(String streetAddress) {
		this.streetAddress = streetAddress;
	}
	public String getStreetAddress() {
		return streetAddress;
	}

	public void setCity(String city) {
		this.city = city;
	}
	public String getCity() {
		return city;
	}
		
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}

	public String getZip() {
		return zip;
	}
	public void setZip(String zip) {
		this.zip = zip;
	}

	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}

	public String getRedemptionCode() {
		return redemptionCode;
	}
	public void setRedemptionCode(String redemptionCode) {
		this.redemptionCode = redemptionCode;
	}

	public Boolean getIsAdministrator() {
		return isAdministrator;
	}
	public void setIsAdministrator(Boolean isAdministrator) {
		this.isAdministrator = isAdministrator;
	}

	public Boolean getIsActive() {
		return isActive;
	}
	public void setIsActive(Boolean isActive) {
		this.isActive = isActive;
	}
}
